///////// Chuyen so sang ky tu

function runFromCharCode() {
    input = document.fromCharCode.input.value;
    //alert(input);
    output = eval("String.fromCharCode(" + input + ")");
    //alert(output);
    input = output;
    document.fromCharCode.input.value = input;
}

//######################################//

///////// Chuyen ky tu sang so

function runCharCodeAt() {
    input1 = document.charCodeAt.input1.value;
    //alert(input);
    output1 = "";
    output2 = "";

    for (i = 0; i < input1.length; ++i) {
        if (output1 != "") output1 += ",";
        output1 += input1.charCodeAt(i);
    }
    //alert(output);
    //output = output;
    output1 = output1;
    output2 = "eval(String.fromCharCode(" + output1 + "));";
    input1 = output1;
    input2 = output2;
    document.charCodeAt.input1.value = input1;
    document.charCodeAt.input2.value = input2;
}
//######################################//

/*  ///////////// Code 2
  var input = document.getElementById('inputtext').value;
  var output = 'eval(String.fromCharCode(';

  for(pos = 0; pos < input.length; pos++) {
    output += input.charCodeAt(pos);
    if(pos != (input.length - 1)) {output += ",";}
  }
  
  output += '))';
  document.getElementById('result').innerHTML = output;
  return 0;
*/